home *** CD-ROM | disk | FTP | other *** search
- /*-----------------------------------------------------------------------------
-
- Generic LaserWriter.h
-
- Header file for Generic LaserWriter.c.
-
- 6/18/94 - dmh - Created while adding 'scan' handling support.
- 8/28/94 - dmh - Finalized for SDK.
-
- © 1991-1994 Apple Computer Inc.
-
- -----------------------------------------------------------------------------*/
-
- #include <ToolUtils.h>
- #include <Types.h>
- #include <Errors.h>
- #include <Resources.h>
- #include <GXPrinterDrivers.h>
- #include <GXMessages.h>
- #include <GXExceptions.h>
-
-
- // Predefined goodies.
-
- #define kCreator 'scL1'
-
-
- // 'scan' entry types.
-
- enum {
- SimpleScan = 0,
- UserNameScan,
- DocumentNameScan,
- PrinterNameScan,
- NilPtrScan
- };
-
-
- // 'scan' offset types.
-
- enum {
- SimpleOffset = 0,
- SameAsPreviousOffset,
- ReturnedOffset,
- SimpleRepeat = 16,
- SameAsPreviousRepeat,
- ReturnedRepeat
- };
-
-
- // 'scan' action types.
-
- enum {
- NoAction = 0,
- SimpleAction
- };
-
-
- // 'scan' error types. (For SimpleAction entries.)
-
- enum {
- Normal = 0,
- NonFatalError,
- FatalError
- };
-
-
- // Values passed to our ScanText routine to indicate which 'scan' to use.
-
- enum {
- kScanStatusTextType,
- kScanPrinterTextType
- };
-
-
- // IDs of the two 'scan' resources we use to pre-scan the data.
-
- #define kStatusTextScanResID (gxPostscriptScanningID +6)
- #define kPrinterTextScanResID (gxPostscriptScanningID +7)
-
-
- // ID of the 'stat' resource we use for alerts and such.
-
- #define kPrescanStatResID (gxPrintingDriverBaseID +10)
-
-
- // Index into our 'stat' resource for the "printerReady" entry.
-
- #define kPrinterIsReadyIndex 1
-
-
- // Our "instance context" global data structure.
-
- typedef struct DriverInstanceGlobals {
- gxStatusRecord *printStatus; // status record for GXAlertTheUser.
- short statusLevel; // last alert level: Normal, NonFatalError or FatalError.
- short statusIndex; // last index into our 'stat' resource passed to GXAlertTheUser.
- Str31 userName; // user name from the currently printing job.
- Str31 appName; // application name from the currently printing job.
- Str31 documentName; // document name from the currently printing job.
- Str31 printerName; // output printer name from the currently printing job.
- } DriverInstanceGlobals, **DriverInstanceGlobalsHdl;
-
-
- // Our "class context" global data structure.
-
- typedef struct DriverClassGlobals {
- long ownerCount; // owner count for our data.
- Handle statusScanHdl; // 'scan' handle for gxPostScriptScanStatusText.
- Handle printerScanHdl; // 'scan' handle for gxPostScriptScanPrinterText.
- } DriverClassGlobals, **DriverClassGlobalsHdl;
-
-
- // Function prototypes.
-
- OSErr DriverOpenConnection(void);
- void DriverCleanupOpenConnection(void);
- OSErr DriverCloseConnection(void);
- OSErr SetUpInstanceContextData(void);
- void StoreInstanceContextStrings(DriverInstanceGlobalsHdl instanceGlobals);
- void DisposeInstanceContextData(void);
- OSErr SetUpClassContextData(void);
- void DisposeClassContextData(void);
- OSErr DriverPostScriptScanPrinterText(Handle textHdl);
- OSErr DriverPostScriptScanStatusText(Handle textHdl);
- OSErr ScanText(Handle textHdl, char scanType, Boolean *alertedUser);
- OSErr HandleScanning(Handle textHdl, Handle scanHdl, Boolean *alertedUser);
-
- OSErr DecodeScanEntry(short **scanPtr,
- char **str1Ptr, long *str1Len,
- char **str2Ptr, long *str2Len,
- short *offsetType, short *actionType,
- short *statusLevel, short *statusIndex);
-
- Boolean MungeTheText(short offsetType, Handle textHdl,
- void *ptr1, long len1,
- void *ptr2, long len2);
-
- OSErr SetAlertStatus(short statResourceID, short statResourceIndex);
-